class GaNewWordsController < ApplicationController
  # GET /ga_new_words
  # GET /ga_new_words.xml
  def index
    @ga_new_words = GaNewWord.paginate :page => params[:page], :per_page => 10, :order => "word_name"

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @ga_new_words }
    end
  end

  # GET /ga_new_words/1
  # GET /ga_new_words/1.xml
  def show
    @ga_new_word = GaNewWord.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @ga_new_word }
    end
  end

  # GET /ga_new_words/new
  # GET /ga_new_words/new.xml
  def new
    @ga_new_word = GaNewWord.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @ga_new_word }
    end
  end

  # GET /ga_new_words/1/edit
  def edit
    @ga_new_word = GaNewWord.find(params[:id])
  end

  # POST /ga_new_words
  # POST /ga_new_words.xml
  def create
    @ga_new_word = GaNewWord.new(params[:ga_new_word])
    @ga_new_word.word_name.to_s.strip!
    respond_to do |format|
      if @ga_new_word.save
        format.html { redirect_to(:action => :index, :notice => 'NewWord was successfully created.') }
        format.xml  { render :xml => @ga_new_word, :status => :created, :location => @ga_new_word }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @ga_new_word.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /ga_new_words/1
  # PUT /ga_new_words/1.xml
  def update
    @ga_new_word = GaNewWord.find(params[:id])
    params[:ga_new_word][:word_name].to_s.strip!
    respond_to do |format|
      if @ga_new_word.update_attributes(params[:ga_new_word])
        format.html { redirect_to(:action => :index, :notice => 'NewWord was successfully updated.') }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @ga_new_word.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /ga_new_words/1
  # DELETE /ga_new_words/1.xml
  def destroy
    @ga_new_word = GaNewWord.find(params[:id])
    @ga_new_word.destroy

    respond_to do |format|
      format.html { redirect_to(ga_new_words_url) }
      format.xml  { head :ok }
    end
  end

end
